package com.wanmait.mpdemo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wanmait.mpdemo.entity.QuestionType;
import com.wanmait.mpdemo.mapper.QuestionTypeMapper;
import com.wanmait.mpdemo.service.QuestionTypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wanmait
 * @since 2022-01-14
 */
@Service
public class QuestionTypeServiceImpl extends ServiceImpl<QuestionTypeMapper, QuestionType> implements QuestionTypeService {

    @Resource
    private QuestionTypeMapper questionTypeMapper;
    @Override
    public void increaseQuestionCount(Integer id) {
        questionTypeMapper.increaseQuestionCount(id);
    }

    @Override
    public List<QuestionType> findAll(String title) {
        LambdaQueryWrapper<QuestionType> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.like(QuestionType::getTitle,title);
        return questionTypeMapper.findAll(queryWrapper);
    }
}
